import csv
import random

random.seed(42)          # 可复现
N = 10_000
rows = []

for _ in range(N):
    h = round(random.uniform(150.0, 200.0), 1)          # cm
    bmi = random.uniform(18.5, 28.0)                    # 正常 BMI 区间
    w = round(bmi * (h/100) ** 2, 1)                    # kg
    rows.append((h, w))

with open('height_weight_10k.csv', 'w', newline='', encoding='utf-8') as f:
    writer = csv.writer(f)
    writer.writerow(['height(cm)', 'weight(kg)'])
    writer.writerows(rows)

print('Done! 已生成 height_weight_10k.csv')